package com.markerhub.service.impl;

import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.markerhub.entity.AppAd;
import com.markerhub.service.AppAdService;
import com.markerhub.service.HomeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class HomeServiceImpl implements HomeService {

    @Resource
    AppAdService appAdService;


    @Override
    public Object getContents() {
        //首页轮播图

        // 首页轮播图
        List<AppAd> carousels = appAdService.list(new QueryWrapper<AppAd>()
                .eq("position", "carousel")
                .eq("is_show", true)
                .orderByDesc("sort_order")
        );

        //2. 分类的数据




        //置顶热销产品的信息





        return MapUtil.builder()
                .put("carousels", carousels)
                //.put("categories", categories)
                //.put("products", products)
                .build();
    }
}
